package com.example.flshtarvel.mapper;

import com.example.flshtarvel.vo.RouteVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RouteViewMapMapper {
    @Insert("insert into route_view_map(route_id,user_id) values(#{routeId},#{userId})")
    public List<RouteVo> insertRouteViewMap(String routeId,String userId);

    @Delete("delete from route_view_map where route_id=#{routeId} and user_id=#{userId}")
    public int deleteRouteViewMap(String routeId,String userId);

    @Select("select * from route,route_view_map where route_view_map.route_id=route.route_id and route_view_map.userId=#{userId} by ORDER BY route_view_map.view_time DESC")
    public List<RouteVo> selectRouteViewMapByUserId(String userId);

}
